package com.ifdom.objecttype.atomicinteger;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 线程安全类 AtomicInteger
 * 与不安全得Interger
 *
 * @Author ifredomvip@gmail.com
 * @Date 2022/9/30 15:15
 * @Version 1.0.0
 * @Description
 **/
public class IntegerDemo implements Runnable {

    private Integer count = 0;

    public IntegerDemo(Integer count) {
        this.count = count;
    }

    public void increment() {
        count++;
    }

    public Integer getCount() {
        return count;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10000; i++) {
            count++;
        }
    }
}
